home *** CD-ROM | disk | FTP | other *** search
- unit StpKey1U;
-
- interface
-
- uses
- WinProcs, WinTypes, Messages, SysUtils, Classes, Graphics, Controls, Forms,
- Dialogs, StdCtrls, Menus;
-
- type
- TForm1 = class(TForm)
- Edit1: TEdit;
- Edit2: TEdit;
- Label1: TLabel;
- Label2: TLabel;
- Label3: TLabel;
- Edit3: TEdit;
- Edit4: TEdit;
- Edit5: TEdit;
- Edit6: TEdit;
- Edit7: TEdit;
- Edit8: TEdit;
- procedure FormKeyDown(Sender: TObject; var Key: Word;
- Shift: TShiftState);
- private
- { Private declarations }
- public
- { Public declarations }
- end;
-
- var
- Form1: TForm1;
-
- implementation
-
- {$R *.DFM}
-
- procedure TForm1.FormKeyDown(Sender: TObject; var Key: Word;
- Shift: TShiftState);
- begin
- { Check for Escape }
- if (Key = vk_Escape) and (Shift = []) then
- begin
- Color := RGB(Random(256), Random(256), Random(256));
- Key := 0
- end;
- { Check for Ctrl+S or Alt+S }
- if (Key = Ord('S')) and ((Shift = [ssCtrl]) or (Shift = [ssAlt])) then
- begin
- if Shift = [ssCtrl] then
- Application.Minimize
- else
- Caption := 'Alt+S was pressed at ' + TimeToStr(Time);
- Key := 0
- end
- end;
-
- initialization
- Randomize
- end.
-